package dataextraction;

import java.util.HashSet;
import java.util.List;

public class Entry implements Comparable<Entry>{
	private String documentTitle;
	private String documentTitleTagged;
	private List<String> authors;
	private String publicationTitle;
	private String publicationYear;
	private String publicationAbstract;
	private String publicationAbstractTagged;
	private String pdfLink;
	private String authorKeywords;
	private String publisher;
	private String id;
	private int numberOfPages;
	
	private HashSet<String> preCriteria = new HashSet<String>();
	
	public HashSet<String> getPreCriteria() {
		return preCriteria;
	}
	
	public void setPreCriteria(HashSet<String> preCriteria) {
		this.preCriteria = preCriteria;
	}
	
	public void setId(String id) {
		this.id = id;
	}
	
	public String getId() {
		return id;
	}
	
	public String getDocumentTitle() {
		return documentTitle;
	}
	public void setDocumentTitle(String documentTitle) {
		this.documentTitle = documentTitle;
	}
	public List<String> getAuthors() {
		return authors;
	}
	public void setAuthors(List<String> authors) {
		this.authors = authors;
	}
	public String getPublicationTitle() {
		return publicationTitle;
	}
	public void setPublicationTitle(String publicationTitle) {
		this.publicationTitle = publicationTitle;
	}
	public String getPublicationYear() {
		return publicationYear;
	}
	public void setPublicationYear(String publicationYear) {
		this.publicationYear = publicationYear;
	}
	public String getPublicationAbstract() {
		return publicationAbstract;
	}
	public void setPublicationAbstract(String publicationAbstract) {
		this.publicationAbstract = publicationAbstract;
	}
	public String getPdfLink() {
		return pdfLink;
	}
	public void setPdfLink(String pdfLink) {
		this.pdfLink = pdfLink;
	}
	public String getAuthorKeywords() {
		return authorKeywords;
	}
	public void setAuthorKeywords(String authorKeywords) {
		this.authorKeywords = authorKeywords;
	}
	public String getPublisher() {
		return publisher;
	}
	public void setPublisher(String publisher) {
		this.publisher = publisher;
	}
	
	public int getNumberOfPages() {
		return numberOfPages;
	}
	
	public void setNumberOfPages(int numberOfPages) {
		this.numberOfPages = numberOfPages;
	}
	
	@Override
	public boolean equals(Object obj) {
		Entry entry = (Entry) obj;
		
		boolean sameTitle = this.getDocumentTitle().trim().toUpperCase().equals(entry.getDocumentTitle().trim().toUpperCase());
		boolean sameAbstract = this.getPublicationAbstract().trim().toUpperCase().equals(entry.getPublicationAbstract().trim().toUpperCase());
		
		return sameTitle || (sameAbstract && !this.getPublicationAbstract().equals("N/A"));
	}

	public int compareTo(Entry o) {
		return this.getDocumentTitle().compareTo(o.getDocumentTitle());
	}

	public String getDocumentTitleTagged() {
		return documentTitleTagged;
	}

	public void setDocumentTitleTagged(String documentTitleTagged) {
		this.documentTitleTagged = documentTitleTagged;
	}

	public String getPublicationAbstractTagged() {
		return publicationAbstractTagged;
	}

	public void setPublicationAbstractTagged(String publicationAbstractTagged) {
		this.publicationAbstractTagged = publicationAbstractTagged;
	}
}
